package com.rupeng.service;

import com.rupeng.annotation.RupengCacheable;
import com.rupeng.annotation.RupengClearCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rupeng.pojo.Role;

@Service
@RupengCacheable
public class RoleService extends BaseService<Role> {
	@Autowired
	private RolePermissionService rolePermissionService;
	@RupengClearCache
	public void insert(Role role, Long[] permissionIds) {
		this.insert(role);
		String name = role.getName();
		role = new Role();
		role.setName(name);
		role = this.selectOne(role);
		rolePermissionService.updateFirst(role.getId(), permissionIds);
	}
}
